package com.sec.android.app.myfiles.feature.knox;

import android.content.Context;

import com.samsung.android.knox.SemPersonaManager;
import com.sec.android.app.myfiles.MyFilesTestRunner;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.module.local.file.LocalFileRecord;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;

import java.util.ArrayList;
import java.util.List;

import static org.mockito.Mockito.when;

/**
 * Created by jaebae on 2016-06-08.
 */
@RunWith(MyFilesTestRunner.class)
public class testKnoxImp {
    private Context mContext;

    public testKnoxImp() {

    }

    @Before
    public void setUp() throws Exception {
        mContext = PowerMockito.mock(Context.class);
        SemPersonaManager personaManager = createSemPersonaManagerMock();
        when(mContext.getSystemService(Mockito.anyString())).thenReturn(personaManager);
    }

    SemPersonaManager createSemPersonaManagerMock() {
        SemPersonaManager personaManager = PowerMockito.mock(SemPersonaManager.class);

        return personaManager;
    }

    @After
    public void tearDown() throws Exception {
    }


    @Test
    public void testGetPathList() {
        KnoxImp knoxImp = new KnoxImp(mContext);
        ArrayList<FileRecord> list = new ArrayList<>();
        list.add(new LocalFileRecord("/Test/test1"));
        list.add(new LocalFileRecord("/Test/test2"));
        list.add(new LocalFileRecord("/Test/testDir"));

        List<String> ret = knoxImp.getPathList(list);
        Assert.assertNotNull(ret);
        Assert.assertTrue(ret.size() > 3);
    }
}
